<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight_objectivec.m</title>
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (Objective-C) - Theme (Breeze Dark)"/>
</head><body style="background-color:#232629;color:#cfcfc2"><pre>
<span style="color:#27ae60;">#import </span><span style="color:#27ae60;">&lt;Fondation/Fondation.h&gt;</span>

<span style="color:#7a7c7d;">// Simple class</span>
<span style="font-weight:bold;">@interface</span> MyClass : Object {
    <span style="color:#7a7c7d;">// instance variables</span>
    <span style="color:#2980b9;">int</span> myVariable
}
<span style="color:#7a7c7d;">// Class methods</span>
+ myClassMethod;
+ (<span style="color:#2980b9;">int</span>)myClassMethod2;
+ (<span style="color:#2980b9;">int</span>)myClassMethod3:(NSString *)parameter;

<span style="color:#7a7c7d;">// Instance methods</span>
- (<span style="color:#2980b9;">int</span>)myInstanceMethod:(NSString *)text;
- (NSString *)myInstanceMethod2:(<span style="color:#2980b9;">int</span>)parameter
                              withText:(NSString *)text;
<span style="font-weight:bold;">@end</span>

<span style="font-weight:bold;">@implementation</span> MyClass
+ (<span style="color:#2980b9;">int</span>)classMethod {
  <span style="font-weight:bold;">return</span> [<span style="font-weight:bold;">self</span> myVariable];
}
- (NSString *)instanceMethod {
    NSString *string = [[NSString alloc]initWithUTF8String:<span style="color:#f44f4f;">&quot;Good string ©&quot;</span>];
    NSLog(<span style="color:#f44f4f;">@&quot;String:%@&quot;</span>,string);
    <span style="font-weight:bold;">return</span> string;
}
<span style="font-weight:bold;">@end</span>


<span style="color:#7a7c7d;">// Protocol</span>
<span style="font-weight:bold;">@protocol</span> MyKeyProtocol
- (<span style="color:#2980b9;">void</span>)lock;
- (<span style="color:#2980b9;">void</span>)unlock;
<span style="font-weight:bold;">@end</span>

<span style="color:#7a7c7d;">// Class that implements a protocol</span>
<span style="font-weight:bold;">@interface</span> MyClass2 : Object &lt;MyKeyProtocol&gt; {

}
<span style="color:#7a7c7d;">// Protocol methods</span>
- (<span style="color:#2980b9;">void</span>)lock;
- (<span style="color:#2980b9;">void</span>)unlock;
<span style="font-weight:bold;">@end</span>
</pre></body></html>
